<template>
  <div class="certificate-container">
    <div class="certificate-card">
      <h1 class="title">食品从业人员健康证明</h1>
      <div class="info-grid">
        <div class="info-item">
          <span class="label1">姓 名：</span>
          <span class="value">{{ data.xm }}</span>
        </div>
        <div class="info-item gender-item" style="width: 90px;">
          <div class="gender-content">
            <span class="label1">性 别：</span>
            <span class="value">{{ data.xb }}</span>
          </div>
        </div>
        <div class="photo-container">
          <div class="photo-placeholder">
            <img :src="data.xpxxBase64" style="width: 88px;height: 103px;position: absolute;"/>
          </div>
        </div>
      </div>

      <div class="info-item id-number">
        <span class="label1">身份证号码：</span>
        <span class="value">{{ data.sfzhm }}</span>
      </div>
      <div class="info-item id-number">
        <span class="label1">(或其他有效证明)</span>
      </div>

      <div class="info-item id-number">
        <span class="label1">体检编号：</span>
        <span class="value">{{ data.tjbh }}</span>
      </div>

      <div class="info-item" style="">
        <span class="label1">体检单位：</span>
        <span class="value">广州仁民中医医院</span>
      </div>

      <div class="info-item">
        <span class="label1">体检日期：</span>
        <span class="value">{{ data.djrqStr }}(有效期一年)</span>
      </div>
    </div>

    <div class="certificate-card" style="margin-top: 5px;height: 170px">
      <div class="title" style="font-family: simsun,serif; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; height: 100%;">
        <view class="title" style="margin-top: 10px">广州仁民中医医院</view>
        <view class="subtitle" style="margin-top: 40px">食品从业人员健康证明</view>
      </div>
    </div>

    <div>
      <img src="/static/images/tijian.png" class="stamp-image"/>
    </div>
  </div>
</template>

<script>
import { getInfo } from "@/api/health"

export default {
  name: 'HealthCertificate',
  data() {
    return {
      data: {},
      queryForm: {
        xm: '',
        sfzhm: '',
        djrq: ''
      }
    }
  },
  created() {

  },
  onLoad(options) {
    if (options.data) {
      this.data = JSON.parse(decodeURIComponent(options.data));
      this.data.xpxxBase64 = 'data:image/jpeg;base64,' + this.data.xpxxBase64
    }
  },
}
</script>

<style scoped>
.certificate-container {
  /* display: flex; */
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #b5ac8f;
  padding: 15px 12px 15px 12px;
}

.certificate-card {
  background-color: white;
  border-radius: 8px;
  padding: 25px;
  line-height: 9px;
  max-width: 500px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  margin-top: 40px;
}

.label1 {
  font-size: 15px;
}

.title {
  text-align: center;
  font-size: 20px;
  margin-bottom: 20px;
  font-weight: bold;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 80%;
  position: relative;
}

.info-item {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.gender-item {
  display: flex;
  justify-content: flex-end;
}

.gender-content {
  display: flex;
  align-items: center;
}

.label {
  min-width: 100px;
  color: #333;
}

.value {
  flex: 1;
  color: #666;
  font-weight: bold;
  font-size: 15px;
}

.photo-container {
  position: absolute;
  right: 15px;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-placeholder {
  color: #999;
}

.stamp-image {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 20%;
  width: 119px;
  height: 72px;
  z-index: 1;
}

@media screen and (max-width: 375px) {
  .stamp-image {
    width: 96px;
    height: 55px;
    left: 65%;
    top: 28%;
  }
}

@media screen and (max-width: 414px) {
  .stamp-image {
	width: 102px;
	height: 55px;
	left: 66%;
	top: 26%;
  }
}

@media screen and (min-width: 415px) and (max-width: 768px) {
  .stamp-image {
    width: 115px;
    height: 68px;
    left: 66%;
    top: 20%;
  }
}

.id-number {
  /* margin-top: 20px; */
}

.upload-info {
  text-align: center;
  margin-top: 30px;
  color: #666;
  font-size: 14px;
}
</style>
